import type { InvoiceDto } from '@/api/finance/types'
import { getDaliyUnInsuranceCompanyList } from '@/api/insurance/company'
import type { InsuranceCompanyBalanceSaleDto } from '@/api/insurance/company/types'
import { getInvoiceList } from '@/api/invoice'
import { getExpireCompanyList } from '@/api/pay'
import type { PageDto, PagesDto } from '@/api/types'
import { getKeyToEnum, getKeyValueToObject, InvoiceTypeCnEnum } from '@/const/enum'
import type { FilterDto } from '@/render/FilterRender'
import TableRender, { type TableRenderColumnTypes } from '@/render/TableRender'
import router from '@/router'
import type { AnyObject } from '@/types'
import toNative from '@/utils/toNative'
import { Component } from 'vue-facing-decorator'
import Render from '@/render/Render'
import type { VxeColumnSlotTypes, VxeGridProps, VxeGridPropTypes, VxeTableDataRow } from 'vxe-table'

@Component
export class FinanceInvoiceNotReady extends TableRender {
    filterConfig(): FilterDto {
        return {
            salesId: {
                name: '所属业务员',
                element: 'select',
                optionsType: 'sale'
            },
            receiptIds: {
                name: '收款账户',
                element: 'input',
            },
            // searchText: {
            //     name: '发票月份',
            //     element: 'input',
            // },
            applicationMonth: {
                name: '申请月份',
                element: 'input',
            },
            companyName: {
                name: '申请公司名',
                element: 'input',
            },
            type: {
                name: '发票类型',
                element: 'select',
                options: getKeyToEnum(InvoiceTypeCnEnum)
            },
        }
    }

    onDetail(row: InvoiceDto) {
        // router.push('/customer/' + row.companyId)
    }

    onLoadData(pageNum: number, pageSize: number, filters: AnyObject){
        return getInvoiceList({
            pageNum,
            pageSize,
            ...filters
        })
    }

    tableColumnConfigOld = () => [
        {
            field: 'companyName',
            title: '申请公司名',
        },
        {
            field: 'month',
            title: '发票月份',
        },
        {
            field: 'type',
            title: '发票类型',
            params: {
                enum: InvoiceTypeCnEnum
            },
            slots: {
                default: 'enum'
            }
        },
        {
            field: 'applyTime',
            title: '申请时间',
        },
        {
            field: 'amount',
            title: '发票金额',
            slots: {
                default: 'price'
            }
        },
        {
            field: 'salesName',
            title: '所属业务员',
        },
        {
            field: 'bankName',
            title: '收款账户',
        },
        {
            field: 'rechargeAmount',
            title: '充值金额',
            slots: {
                default: 'price'
            }
        },
    ] as TableRenderColumnTypes<InvoiceDto>



}

export default toNative(FinanceInvoiceNotReady)
